<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Product extends MY_Controller {
	function __construct(){
		parent::__construct();
		$this->load->model('page_model');
		$this->load->model('article_model');
		$this->load->model('gallery_model');
		$this->load->model('coltypes_model');
	}
	//箱包
	public function index($id='',$page=1){
		$data['nav']=$this->db->order_by('sort_id','asc')->get_where('coltypes',array('cid'=>2))->result_array();
		if(empty($id)){
       $id=$data['nav'][0]['id'];
    }
    $data['nowId']=$id;
		/*分页*/
		$config['base_url'] = SITE_URL.'product/index/'.$id.'/';//分页地址
		$config['uri_segment'] = 4;//页码所在URI段
		//计算当前页面新闻总条数
		$where=array('audit'=>1,'ctype'=>$id);
		$config['total_rows'] = $this->db->where($where)->from('article')->count_all_results();
		$config['per_page'] =9;//每页显示的条数
		$config['use_page_numbers'] = TRUE;//默认分页URL中是显示每页记录数,启用use_page_numbers后显示的是当前页码。
		$config['cur_tag_open']= '<a class="active">';
		$config['cur_tag_close']='</a>';
		$config['full_tag_open'] = '<div class="page">';
		$config['full_tag_close'] = '</div>';
		$config['num_links']=5;
		$config['cur_tag_open']='<a href="#" class="active">';
		$config['cur_tag_close']='</a>';
		$config['prev_link']='<';
		$config['next_link']='>';
		$config['num_tag_open']='';
 		$config['num_tag_close']='';
 		$config['prev_tag_open']='';
 		$config['prev_tag_close']='';
 		$config['next_tag_open']='';
 		$config['next_tag_close']='';
		$data['fenye']=$this->article_model->news_page($config,$id,$where,$page);
		$data['seo']=$this->db->get_where('columns',array('id'=>2))->row_array();//获取seo
		$this->load->view('product',$data);
	}
	
	//服饰
	public function index1($id='',$page=1){
		$data['nav']=$this->db->order_by('sort_id','asc')->get_where('coltypes',array('cid'=>3))->result_array();
		if(empty($id)){
			$id=$data['nav'][0]['id'];
		}
		$data['nowId']=$id;
		/*分页*/
		$config['base_url'] = SITE_URL.'product/index1/'.$id.'/';//分页地址
		$config['uri_segment'] = 4;//页码所在URI段
		//计算当前页面新闻总条数
		$where=array('audit'=>1,'ctype'=>$id);
		$config['total_rows'] = $this->db->where($where)->from('article')->count_all_results();
		$config['per_page'] =9;//每页显示的条数
		$config['use_page_numbers'] = TRUE;//默认分页URL中是显示每页记录数,启用use_page_numbers后显示的是当前页码。
		$config['cur_tag_open']= '<a class="active">';
		$config['cur_tag_close']='</a>';
		$config['full_tag_open'] = '<div class="page">';
		$config['full_tag_close'] = '</div>';
		$config['num_links']=5;
		$config['cur_tag_open']='<a href="#" class="active">';
		$config['cur_tag_close']='</a>';
		$config['prev_link']='<';
		$config['next_link']='>';
		$config['num_tag_open']='';
 		$config['num_tag_close']='';
 		$config['prev_tag_open']='';
 		$config['prev_tag_close']='';
 		$config['next_tag_open']='';
 		$config['next_tag_close']='';
		$data['fenye']=$this->article_model->news_page($config,$id,$where,$page);
		$data['seo']=$this->db->get_where('columns',array('id'=>3))->row_array();//获取seo
		$this->load->view('product1',$data);
	}
	
	//生活/家居
	public function index2($id='',$page=1){
		$data['nav']=$this->db->order_by('sort_id','asc')->get_where('coltypes',array('cid'=>4))->result_array();
		if(empty($id)){
			$id=$data['nav'][0]['id'];
		}
		$data['nowId']=$id;
		/*分页*/
		$config['base_url'] = SITE_URL.'product/index2/'.$id.'/';//分页地址
		$config['uri_segment'] = 4;//页码所在URI段
		//计算当前页面新闻总条数
		$where=array('audit'=>1,'ctype'=>$id);
		$config['total_rows'] = $this->db->where($where)->from('article')->count_all_results();
		$config['per_page'] =9;//每页显示的条数
		$config['use_page_numbers'] = TRUE;//默认分页URL中是显示每页记录数,启用use_page_numbers后显示的是当前页码。
		$config['cur_tag_open']= '<a class="active">';
		$config['cur_tag_close']='</a>';
		$config['full_tag_open'] = '<div class="page">';
		$config['full_tag_close'] = '</div>';
		$config['num_links']=5;
		$config['cur_tag_open']='<a href="#" class="active">';
		$config['cur_tag_close']='</a>';
		$config['prev_link']='<';
		$config['next_link']='>';
		$config['num_tag_open']='';
 		$config['num_tag_close']='';
 		$config['prev_tag_open']='';
 		$config['prev_tag_close']='';
 		$config['next_tag_open']='';
 		$config['next_tag_close']='';
		$data['fenye']=$this->article_model->news_page($config,$id,$where,$page);
		$data['seo']=$this->db->get_where('columns',array('id'=>4))->row_array();//获取seo
		$this->load->view('product2',$data);
	}
	
	
	
	
	
	
	
	
	
	
	
}